package com.mz.base.util;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.json.JSONArray;

public class ATTSystem {

	/** 登录用户session key */
	public static final String KEY_SESSION_LOGIN = "sysUsers";
	
	/** 列表分页查询 request key */
	public static final String KEY_REQUEST_PAGE = "page";
	
	/** 记录已删除标记值 */
	public static final Integer MARK_DELETE = -1;

	/** 用户权限菜单缓存空间 */
	public static Map<String, JSONArray> MAP_ROLE_MENU = new HashMap<String, JSONArray>();
	
	/** 系统角色拥有的权限菜单 */
	public static Map<String, List<Long>> MAP_MENU_URI_ROLE = new HashMap<String, List<Long>>();
	
	/** 已登录用户的MAP集合 */
	public static Map<String, Long> MAP_SESSION_USERID = new HashMap<String, Long>();
	/**
	 * 讲登录用户数据保存至map
	 * @param sessionId
	 * @param userId
	 */
	public static void putMapSessionUserid(String sessionId, Long userId){
		Long val = null;
		for(String key : MAP_SESSION_USERID.keySet()){
			val = MAP_SESSION_USERID.get(key);
			if(val!=null && val==userId){
				MAP_SESSION_USERID.remove(key);
			}
		}
		MAP_SESSION_USERID.put(sessionId, userId);
	}
	
	/** 不需要登录并且不需要权限验证的URI */
	public static String[] LIST_NOT_LOGIN_URI = new String[]{"/", "/login.jsp", "/index.jsp", "/login", "*.css", "*.js", "*.jpg", "*.png", "*.html", "/AuthCode/*", "/layui/*", "/log.jsp"};
	
	
}